package com.iwhalecloud.citybrain.flow.platform.manager.domain.model;

import com.iwhalecloud.citybrain.flow.platform.manager.domain.enums.MultiInstanceKeyEnum;
import lombok.Data;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

import java.io.Serializable;

/**
 * @author lilh
 * @date 2021/6/7 10:00
 */
@Data
public class CompletionCondition implements Serializable, ApplicationContextAware {


    private static final long serialVersionUID = 6052441791601417167L;

    /**
     * 部署id
     */
    private String deploymentId;

    /**
     * 节点编码
     */
    private String nodeCode;

    /**
     * 配置信息
     */
    private String value;

    public void save(){
        ModelCustomConfigDomain modelCustomConfig = new ModelCustomConfigDomain();
        modelCustomConfig.setDeploymentId(deploymentId);
        modelCustomConfig.setType(MultiInstanceKeyEnum.COMPLETION_CONDITION.getCode());
        modelCustomConfig.setNodeCode(nodeCode);
        modelCustomConfig.setConfig(value);
        modelCustomConfig.save();
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {

    }
}
